<template>
   <div class="user">
      <!-- 顶部导航 -->
      <van-nav-bar title="个人中心" left-text="返回" right-text="退出" left-arrow @click-left="$router.back()"
         @click-right="logout" />
      <!-- 显示的用户信息 -->
      <div class="content">
         <van-cell-group title="个人中心">
            <van-cell title="地址管理" is-link to='/address' />
            <van-cell title="订单中心" is-link to='/order' />
         </van-cell-group>
      </div>
   </div>
   <!-- 底部导航 -->
   <HomeFooter />
</template>

<script setup lang="ts">
import HomeFooter from '@/components/HomeFooter.vue'
import { useUserStore } from '@/store/userStore'
import { useRouter } from 'vue-router';
const router = useRouter()
// 用户store
const user = useUserStore()
const logout = () => {
   user.logout();
   router.push('/login')
}
</script>

<style scoped lang="scss">
.user {
   padding-bottom: 50px;

   .content {
      padding-top: 15px;
   }
}
</style>
